package com.junjun.ssm.dao;

import com.junjun.ssm.entity.OrderEntity;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import java.util.List;

public interface OrderDao extends CrudRepository<OrderEntity, Long> {
    @Query("from OrderEntity o where o.userId=?1 and o.payment=?2")
    OrderEntity findByUserId(int id, int payment);


    @Query("from OrderEntity o where o.orderId=?1")
    OrderEntity findByOrderId(Long id);


    @Query("from OrderEntity ")
    List<OrderEntity> queryAll();


    @Query("from OrderEntity o where o.userId=?1 and o.payment=?2")
    List<OrderEntity> queryAllUnpaidOrder(int id, int payment);
}
